/**
 * 购物车
 */

import { defineStore } from 'pinia'
import { ref } from 'vue'
import { StoreName } from '../store-enum.d'

export const useCartStore = defineStore(
  StoreName.CART,

  () => {
    /** 购物车列表 */
    const cartList = ref([])

    return {
      cartList
    }
  },

  {
    /** 持久化存储，默认存储到localstoreage */
    persist: {
      key: 'cart-store' // 存储到localstorage中的key名称
    }
  }
)
